// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store
const api = {
  /**
     * 获取开证公司货权转移
     * @param {Object} params 检索条件的obj
     */
  reqGetIssuingCargoTransfer(params) {
    return Service.get(
      `/${ServiceName}/api/external/issuingCargoTransfer/queryall`,
      { params }
    )
  },
  /**
     * 查看提单备注
     * @param {String} id 提单id
     */
  reqGetBillRemark(id) {
    return Service.get(
      `/${ServiceName}/api/external/issuingCargoTransfer/queryBill?cargoInfoId=${id}`
    )
  },

  /**
     * 修改提单备注
     * @param {Object} params {id:"提单id",remark:"备注"}
     */
  reqEditBillRemark(params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/issuingCargoTransfer/updateBill`,
      params
    )
  },

  /**
     * 货权转让查询
     * @param {Object} params {cargoInfoId：票货ID,startTime:'yyyy-MM-dd HH',endTime:'yyyy-MM-dd HH'}
     */
  reqGetCargoTransfer(params) {
    return Service.get(
      `/${ServiceName}/api/external/issuingCargoTransfer/getTransferInfoByCargoInfoId`,
      { params }
    )
  },
  /**
     * 新建货权转让
     */
  reqAddTransfer(params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/issuingCargoTransfer/addTransfer`,
      params
    )
  },
  /**
     * 修改货权转让
     * @param {Object} params 编辑的form
     */
  reqEditTransfer(params) {
    return Service.post(
      `/${ServiceName}/api/external/issuingCargoTransfer/updateTransfer`,
      params
    )
  },
  /**
   * 删除数据
   * @param {*} id 数据id
   */
  reqDelete(id) {
    return Service.delete(
      `/${ServiceName}/api/external/issuingCargoTransfer/deleteTransfer?id=${id}`
    )
  }
}
export default api
